{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/components/Avatar/index.tsx\",\n  _s = $RefreshSig$();\nimport React from \"react\";\nimport { generateAvatarByNickname } from \"../../utils/helpers\";\nimport { Carousel } from \"../index\";\nimport classNames from \"classnames\";\nimport './Avatar.scss';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst Avatar = _ref => {\n  _s();\n  let {\n    contentList,\n    alt,\n    stringForGenerateColor,\n    stringForFirstCharacter,\n    shortAvatar = true\n  } = _ref;\n  const [collection, setCollection] = React.useState();\n  const [lengthContent, setLengthContent] = React.useState(0);\n  React.useEffect(() => {\n    if (!shortAvatar && contentList !== null && contentList !== void 0 && contentList.items.length) {\n      setLengthContent(contentList.items.length);\n      setCollection(contentList.items.map((item, index) => {\n        return /*#__PURE__*/_jsxDEV(\"img\", {\n          className: \"avatar\",\n          src: item.link,\n          alt: 'Avatar ' + alt\n        }, index, false, {\n          fileName: _jsxFileName,\n          lineNumber: 19,\n          columnNumber: 25\n        }, this);\n      }));\n    }\n  }, [contentList]);\n  if (contentList && contentList.items && contentList.items.length > 0 && shortAvatar) {\n    return /*#__PURE__*/_jsxDEV(\"img\", {\n      className: \"avatar\",\n      src: contentList.items[0].link,\n      alt: 'Avatar ' + alt\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 28,\n      columnNumber: 13\n    }, this);\n  } else if (shortAvatar) {\n    const {\n      colors\n    } = generateAvatarByNickname(stringForGenerateColor);\n    const firstChar = stringForFirstCharacter[0].toUpperCase();\n    return /*#__PURE__*/_jsxDEV(\"div\", {\n      style: {\n        background: `linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`\n      },\n      className: \"avatar avatar--symbol\",\n      children: firstChar\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 35,\n      columnNumber: 13\n    }, this);\n  } else {\n    if (contentList && collection) {\n      return /*#__PURE__*/_jsxDEV(Carousel, {\n        width: 200,\n        children: [collection, lengthContent < 6 && /*#__PURE__*/_jsxDEV(\"div\", {\n          className: classNames('avatar', 'uploadAvatar')\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 48,\n          columnNumber: 25\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 45,\n        columnNumber: 17\n      }, this);\n    } else {\n      const {\n        colors\n      } = generateAvatarByNickname(stringForGenerateColor);\n      const firstChar = stringForFirstCharacter[0].toUpperCase();\n      return /*#__PURE__*/_jsxDEV(Carousel, {\n        width: 200,\n        customBackground: `linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`,\n        children: [/*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"avatar avatar--symbol\",\n          children: firstChar\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 61,\n          columnNumber: 21\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: classNames('avatar', 'uploadAvatar')\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 64,\n          columnNumber: 21\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 58,\n        columnNumber: 17\n      }, this);\n    }\n  }\n};\n_s(Avatar, \"1OmvaPSwM71eXYIM0Pp2GuMzfbA=\");\n_c = Avatar;\nexport default Avatar;\nvar _c;\n$RefreshReg$(_c, \"Avatar\");","map":{"version":3,"names":["React","generateAvatarByNickname","Carousel","classNames","Avatar","contentList","alt","stringForGenerateColor","stringForFirstCharacter","shortAvatar","collection","setCollection","useState","lengthContent","setLengthContent","useEffect","items","length","map","item","index","link","colors","firstChar","toUpperCase","background","color","colorLighten"],"sources":["/data/messenger.client/src/components/Avatar/index.tsx"],"sourcesContent":["import React from \"react\";\nimport {AvatarProps} from \"../../models/props/AvatarProps\";\nimport { generateAvatarByNickname } from \"../../utils/helpers\";\nimport {Carousel} from \"../index\";\nimport classNames from \"classnames\";\nimport './Avatar.scss';\n\nconst Avatar: React.FC<AvatarProps> = ({contentList, alt, stringForGenerateColor, stringForFirstCharacter, shortAvatar = true}) => {\n    const [collection, setCollection] = React.useState<React.ReactNode |React.ReactNode[]>();\n    const [lengthContent, setLengthContent] = React.useState<number>(0);\n\n\n    React.useEffect(() => {\n        if (!shortAvatar && contentList?.items.length!) {\n            setLengthContent(contentList.items.length);\n            setCollection(\n                contentList.items.map((item, index) => {\n                    return (\n                        <img key={index} className='avatar' src={item.link} alt={'Avatar ' + alt}/>\n                    );\n                })\n            );\n        }\n    }, [contentList]);\n\n    if (contentList && contentList.items && contentList.items.length > 0 && shortAvatar) {\n        return (\n            <img className='avatar' src={contentList.items[0].link} alt={'Avatar ' + alt}/>\n        );\n    } else if (shortAvatar) {\n        const {colors} = generateAvatarByNickname(stringForGenerateColor);\n        const firstChar = stringForFirstCharacter[0].toUpperCase();\n\n        return (\n            <div\n                style={{background: `linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`}}\n                className='avatar avatar--symbol'\n            >\n                {firstChar}\n            </div>\n        );\n    } else {\n        if (contentList && collection!) {\n            return (\n                <Carousel width={200} >\n                    {collection}\n                    {lengthContent < 6 &&\n                        <div className={classNames('avatar', 'uploadAvatar')}\n                        />\n                    }\n                </Carousel>\n            );\n        } else {\n            const {colors} = generateAvatarByNickname(stringForGenerateColor);\n            const firstChar = stringForFirstCharacter[0].toUpperCase();\n\n            return (\n                <Carousel width={200}\n                          customBackground={`linear-gradient(135deg, ${colors.color} 0%, ${colors.colorLighten} 96.52%)`}\n                >\n                    <div className='avatar avatar--symbol'>\n                        {firstChar}\n                    </div>\n                    <div className={classNames('avatar', 'uploadAvatar')}\n                    />\n                </Carousel>\n            );\n        }\n    }\n}\n\nexport default Avatar;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,wBAAwB,QAAQ,qBAAqB;AAC9D,SAAQC,QAAQ,QAAO,UAAU;AACjC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAO,eAAe;AAAC;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